namespace ConfiguringApps.Infrastructure
{
  public class BrowserTypeMiddleware
  {
    private RequestDelegate nextDelegate;
    public BrowserTypeMiddleware(RequestDelegate next) => nextDelegate = next;
    public async Task Invoke(HttpContext httpContext)
    {
      httpContext.Items["EdgeBrowser"] = httpContext.Request.Headers["User-Agent"].Any(v => v.ToLower().Contains("edge"));
      await nextDelegate.Invoke(httpContext);
    }
  }
}
